<%- include('header') %>

<script>
    function displayHideUI(view_id)
    {
        var ui =document.getElementById(view_id);
        ui.style.display="none";
    }
    function displayShowUI(view_id)
    {
        var ui =document.getElementById(view_id);
        ui.style.display="";//display为空的话会好使，为block会使后边的空间换行
    }
    function identitySelected(identity) {
        if ("教师" == identity || "管理员" == identity) {
//            displayHideUI("student_name");
            displayHideUI("student_id");
            displayShowUI("teacher_id");
        } else { // "p" and "s"
//            displayShowUI("student_name");
            displayShowUI("student_id");
            displayHideUI("teacher_id");
        }
    }
</script>

<form class="ui form segment" method="post" enctype="multipart/form-data"
      style="margin-left: 20px; margin-right: 20px">
    <div class="field" style="display: none">
        <label>用户id</label>
        <input placeholder="用户id" type="text" name="user_id" value="<%- user_id %>">
    </div>
    <div class="field required">
        <label>用户名</label>
        <input placeholder="用户名" type="text" name="name" value="<%- name %>">
    </div>
    <!--<div class="field required">-->
    <!--<label>密码</label>-->
    <!--<input placeholder="密码" type="password" name="password">-->
    <!--</div>-->
    <!--<div class="field required">-->
    <!--<label>重复密码</label>-->
    <!--<input placeholder="重复密码" type="password" name="repassword">-->
    <!--</div>-->
    <div class="field">
        <label>性别</label>
        <select class="ui compact selection dropdown" name="gender">
            <option value="保密">保密</option>
            <option value="男">男</option>
            <option value="女">女</option>
        </select>
    </div>
    <div class="field required">
        <label>身份</label>
        <select class="ui compact selection dropdown" name="identity" onchange="identitySelected(this.value)">
            <option value="家长" selected>家长</option>
            <option value="教师">教师</option>
            <option value="学生">学生</option>
        </select>
    </div>
    <!--<div id="student_name" class="field required">-->
    <!--<label>学生姓名</label>-->
    <!--<input placeholder="学生姓名" type="text" name="student_name">-->
    <!--</div>-->
    <div id="student_id" class="field required">
        <label>学生学号</label>
        <input placeholder="学生学号" type="text" name="student_id">
    </div>
    <div id="teacher_id" class="field required" style="display: none">
        <label>教师证号</label>
        <input placeholder="教师证号" type="text" name="teacher_id">
    </div>
    <div class="field">
        <label>头像</label>
        <input type="file" name="avatar">
    </div>
    <!--<div class="field required">-->
    <!--<label>个人简介</label>-->
    <!--<textarea name="bio" rows="5"></textarea>-->
    <!--</div>-->
    <input type="submit" class="ui button fluid" value="注册">
</form>

<%- include('footer') %>
